package br.ufpe.cin.rgms.linhapesquisa.apresentacao;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import br.ufpe.cin.rgms.Facade;
import br.ufpe.cin.rgms.linhapesquisa.modelo.LinhaPesquisa;
import br.ufpe.cin.rgms.util.Properties;

public class RemoverLinhaPesquisaServlet extends HttpServlet{

	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
	throws ServletException, IOException {
		String id = (String)request.getParameter("linhapesquisa");
		int idLinhaPesquisa = Integer.parseInt(id);

		LinhaPesquisa linhapesquisa = Facade.getInstance().getLinhaPesquisa(idLinhaPesquisa);


		Facade.getInstance().removerLinhaPesquisa(linhapesquisa);

		request.setAttribute("linhapesquisastatus", Properties.getProperty(this.getServletContext(),"delecao_sucesso"));

		RequestDispatcher view = request.getRequestDispatcher("linhapesquisastatus.jsp");
		view.forward(request, response);
	}
}
